// components/star/index.js
const componentBehavior = require('../../js/common/ComponentBehavior')

Component({
  /**
   * 组件的属性列表
   */
  properties: {
    length: {
      type: Number,
      value: 5
    },
    score: {
      type: Number,
      value: 0
    },
    hasTxt: {
      type: Boolean,    //是否显示文字
      value: false
    },
    isAct: {
      type: Boolean,    //是否可点击
      value: false
    },
    key:{
      type:String,
      value:""
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },
  
  behaviors: [componentBehavior],

  /**
   * 组件的方法列表
   */
  methods: {
    /**
     * 打分
     */
    _changeScore: function (e) {
      const { index } = e.currentTarget.dataset;
      this.setData({
        score: index + 1
      });
      this.triggerEvent("onStartNumEvent", this.data);
    }
  }
})
